<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/2 0002
 * Time: 13:57
 */
//创建server对象，监听127.0.0.1:9502端口，类型为swoole_sock_udp
$serv = new swoole_server("127.0.0.1", 9502, SWOOLE_PROCESS, SWOOLE_SOCK_UDP);

//监听数据接收事件
$serv->on('Packet', function($serv, $data, $clientinfo){
    $serv->sendto($clientinfo['address'], $clientinfo['port'], "server ".$data);
    var_dump($clientinfo);
});

//启动服务
$serv->start();











